/**
 * 策略模式
 */


class Strategy {}

Strategy.prototype.show = () => {}

class StrategyA extends Strategy {
  constructor() {
    super()
  }

  show() {
    console.log('为圣诞节准备的活动A')
  }

}

class StrategyB extends Strategy {
  constructor() {
    super()
  }

  show() {
    console.log('为圣诞节准备的活动B')
  }

}

class StrategyC extends Strategy {
  constructor() {
    super()
  }

  show() {
    console.log('为圣诞节准备的活动C')
  }

}

class Saler {
  constructor(activity) {
    switch(activity) {
      case 'A':
        this.activity = new StrategyA()     
        break
      case 'B':
        this.activity = new StrategyB()
        break
      case 'C':
        this.activity = new StrategyC()
        break
      default:
        console.log('没有活动。。。')
        break
    }
  } 
}

const activityA = new Saler('A')
const activityB = new Saler('B')
const activityC = new Saler('C')

activityA.activity.show()
activityB.activity.show()
activityC.activity.show()
